package de.fme.urlshortener;

import junit.framework.TestCase;

public class BitlyUrlShortenerTest extends TestCase
{
    private FmeBitlyUrlShortenerImpl shortener;
    
    public void testShorten()
    {
        String url = "http://www.fme.de/";
        String shortUrl = shortener.shortenUrl(url);
        assertNotNull(shortUrl);
        assertFalse(shortUrl.isEmpty());
        assertFalse(url.equals(shortUrl));
        assertTrue(shortUrl.length()<=20);
    }
    
    /**
    * {@inheritDoc}
    */
    @Override
    protected void setUp() throws Exception
    {
        this.shortener = new FmeBitlyUrlShortenerImpl();;
        shortener.setApiKey("R_b79a909f6cee18710550b50b8e6e85f2");
        shortener.setUrlLength(20);
        shortener.setUsername("o_58amgm89k5");
    }
}
